import Router from "@/router";
// import { Toast } from "vant";

/**
 * 写入本地存储
 */
export function setObj(name, obj) {
  localStorage.setItem(name, JSON.stringify(obj));
}

/**
 * 读取本地存储
 */
export function getObj(name) {
  return JSON.parse(localStorage.getItem(name));
}

/**
 * 移除本地存储
 */
export function removeObj(name) {
  localStorage.removeItem(name);
}

/**
 * 底部toast
 */
export function ToastBottom(msg) {
  // return Toast({ message: msg, position: "bottom" });
}

/**
 * 退出登录
 */
export function LogOut() {
  console.log("logout");
  removeObj("public_Authorization");
  removeObj("public_user_id");
  Router.replace({ path: "/" });
}
